﻿using System;
using System.Threading;

namespace UIAStudio
{
    public class CallbackWorkItem : WorkItem
    {
        private ThreadStart _callback;

        public CallbackWorkItem(WorkQueue queue, ThreadStart callback)
            : base(queue)
        {
            Validate.ArgumentNotNull(callback, "callback");
            this._callback = callback;
        }

        protected override void Dispose(bool disposing)
        {
            this._callback = null;
            base.Dispose(disposing);
        }

        public override void Execute()
        {
            this._callback();
        }
    }
}
